<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>plltrack</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="platerev.html" title="platerev" />
    <link rel="next" href="pluck.html" title="pluck" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">plltrack</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="platerev.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="pluck.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="plltrack"></a>
      <div class="titlepage"></div>
      <a id="Indexplltrack" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">plltrack</span>
        </h2>
        <p>plltrack — 
      Tracks the pitch of a signal.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp134631616"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>plltrack</em></span>, a pitch tracker based on a phase-locked loop algorithm, described in Zolzer, U, Sankarababu, S.V. and Moller, S, "PLL-based Pitch Detection and Tracking for Audio Signals. Proc. of IIH-MSP 2012".
      </p>
      </div>
      <div class="refsect1">
        <a id="idp134633680"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">acps, alock <span class="command"><strong>plltrack</strong></span> asig, kd [, kloopf, kloopq, klf, khf, kthresh]</pre>
      </div>
      <div class="refsect1">
        <a id="idp134635952"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>acps</em></span> -- estimated pitch in Hz.
    </p>
        <p>
      <span class="emphasis"><em>alock</em></span> -- phase lock indicator, a phase error indicating the quality of the tracking, with values between 0 and 1. Higher values
indicate good tracking
    </p>
        <p>
      <span class="emphasis"><em>kd</em></span> -- PLL feedback gain, controls frequency range of PLL (between 0 and 1). Higher values increase the range of the tracking.
    </p>
        <p>
      <span class="emphasis"><em>kloopf</em></span> -- PLL LP filter cf, controls frequency range of PLL (opt, defaults to 20Hz).
    </p>
        <p>
      <span class="emphasis"><em>kloopq</em></span> -- PLL LP filter Q, controls rise time of FO step (opt, defaults to 1/3)
    </p>
        <p>
      <span class="emphasis"><em>klf</em></span> -- lowest tracking freq (opt, defaults to 20Hz)
    </p>
        <p>
      <span class="emphasis"><em>khf</em></span> -- highest tracking freq (opt, defaults to 1500Hz)
    </p>
        <p>
      <span class="emphasis"><em>kthresh</em></span> --  tracking signal level threshold (optional, defaults to 0.001, equiv to -60dBfs)
    </p>
        <p>
      <span class="emphasis"><em>plltrack</em></span> analyzes the input signal, <span class="emphasis"><em>asig</em></span>, 
      estimating the fundamental of a monophonic signal. Its output is updated every sample.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp134705296"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the plltrack operator. It uses the file <a class="ulink" href="examples/plltrack.csd" target="_top"><em class="citetitle">plltrack.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp134707152"></a>
          <p class="title">
            <strong>Example 633. Example of the plltrack operator.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac    <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o plltrack.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

kd <span class="op">=</span> p4
a1 <span class="opc">diskin2</span> "fox.wav", 1,0,1
apitch, aloc <span class="opc">plltrack</span> a1, kd
krms <span class="opc">rms</span> a1
krms <span class="opc">port</span> krms, 0.01
asig <span class="opc">buzz</span> krms, apitch, 10, 1
     <span class="opc">outs</span> asig, asig		<span class="comment">;mix in some dry signal as well</span>

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span>1 0 65536 10 1	<span class="comment">;sine wave</span>

<span class="stamnt">i</span> 1 0 6 0.1
<span class="stamnt">i</span> 1 7 6 0.3	<span class="comment">;more feedback</span>

<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp134711376"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Victor Lazzarini</td>
          </tr>
          <tr>
            <td>NUI, Maynooth.</td>
          </tr>
          <tr>
            <td>Maynooth, Ireland</td>
          </tr>
          <tr>
            <td>September, 2012</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 5.18.031</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="platerev.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="pluck.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">platerev </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> pluck</td>
        </tr>
      </table>
    </div>
  </body>
</html>
